import {defineStore} from 'pinia'
import request from '@/utils/request'
import {ResApi,GoodsInfo} from '@/types/data'

const useGoodsStore  = defineStore('goods',{
    state(){
        return {
            goodsInfo:{} as GoodsInfo
        }
    },
    actions:{
        async getGoodsInfo(id:string){
            const res = await request.get<ResApi<GoodsInfo>>('/goods',{params:{id}})
            this.goodsInfo = res.data.result
        }
    },
    getters:{}
})

export default useGoodsStore